<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
        <%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<jsp:include page="/common/commonCss.jsp"/>
<jsp:include page="/common/commonJs.jsp"/>
 <script src="${basePath}commonJs/jquery.ztree.all.js"></script>
 <script type="text/javascript" src="${basePath}commonJs/ajaxfileupload.js"></script>
<title>嘉童游乐中心-商品出库清单</title>
<SCRIPT type="text/javascript">

		 $(document).ready(function(){
			 createTable();
		}); 
		
		function createTable()
		{
			$.ajax({
				url:"${basePath}/StockGoodsOut/getProductListForDetail.shtml",
				data:{"fkOutstgId":"${scmOutStg['pkOutstgId']}"},
				dataType:"json",
				type:"post",
				async:false,
				success:function (result)
				{
					callback(result);
				},
				error : function(XMLHttpRequest) {
					ajaxError(XMLHttpRequest);
				}
			});
		}
		
		function callback(data) {
			if(data == null)
				{
				return;
				}
			var htm="";
			trimJsonArray(data);
			$.each(data, function(ind, obj) {
				 var i = ind+1;
				 var num = (obj.stgCnt == null ? 0 : obj.stgCnt);
				 htm += "<tr><td>" +i + "</td>";
				 htm += "<td>" + obj.fkPrdId + "</td>";
				 htm += "<td name='prdName'>" + obj.prdName + "</td>";
		         htm += "<td name='cateName'>" + obj.cateName + "</td>";
		         htm += "<td name='prdSpec'>" + obj.prdSpec+ "</td>";
		         htm += "<td name='unitName'>" + obj.unitName + "</td>";
		         htm+="<td name='stgCnt'>"+num+"</td>";
		         htm+="<td>"+ obj.outstgCnt +"</td>";
		         htm+="<td>"+ obj.signature +"</td>";
		         var comm = obj.comments;
					if((comm !=null || comm !="") && comm.length > 15 )
						{
							msg = comm.substr(0,15) + "...";
						}
						else if(comm == null)
						{
							msg = "";
						}
						else
						{
							msg = comm;
						}
			      htm += "<td title = '"+comm+"'>"+msg+"</td></tr>";
			});
			$("#tbody").html(htm);
		  }
		
		 function downloadFileFun()
		 {
			 $("#downloadFileForm")[0].submit();
		 }
	</SCRIPT>
	</head>
<body class="bg">
<div class="content m_auto">
	<div class="content_l mt10">
    	<ul>
        	<shiro:hasPermission name="StockGoodsIn/toStock_goodsIn.shtml">
					<li><a href="${basePath}StockGoodsIn/toStock_goodsIn.shtml"><i class="nav_icon_b"></i><br>商品入库</a></li>
				</shiro:hasPermission>
				<shiro:hasPermission name="StockQuery/toStockQuery.shtml">
					<li><a href="${basePath}StockQuery/toStockQuery.shtml"><i class="nav_icon_b"></i><br>库存查询</a></li>
				</shiro:hasPermission>
				<shiro:hasPermission name="StockGoodsOut/toStockGoodsOut.shtml">
					<li class="content_hover"><a href="${basePath}StockGoodsOut/toStockGoodsOut.shtml"><i class="nav_icon_b"></i><br>商品出库</a></li>
				</shiro:hasPermission>
				<shiro:hasPermission name="StockTaking/toStockTaking.shtml">
					<li><a href="${basePath}StockTaking/toStockTaking.shtml"><i class="nav_icon_a"></i><br>库存盘点</a></li>
				</shiro:hasPermission>
				<shiro:hasPermission name="StockCorrect/toStockCorrect.shtml">
					<li><a href="${basePath}StockCorrect/toStockCorrect.shtml"><i class="nav_icon_f"></i><br>库存调整</a></li>
				</shiro:hasPermission>
			</ul>
    </div>
    <div class="content_r mt10">
    	<div class="p20">
    	<div class="file_single_dl f14 fixed">
    	    <dl class="fixed"  >
            	<dd><label> 商品出库清单</label></dd>
            	  
            </dl>
            <hr>
       		 <dl class="fixed"  >
                <dd > <label>出库单编号：</label>${scmOutStg['pkOutstgId']}</dd>
                <dd><label>制单人：</label>${scmOutStg['usrName']}</dd>
            </dl>
            <hr>
        	<dl class="fixed" style="overflow:hidden">
            	<dd><label>出货仓库：</label>${scmOutStg['branName']}
                </dd>
                
                <dd><label>制单时间：</label>${modiTime}</dd>
            </dl>
            <hr>
             <dl class="fixed"  >
             <dd class="lv">
					<label>入库单附件下载：</label>
					<a href="" onclick="downloadFileFun();return false">${scmOutStg['fkAttFile']}</a>
				</dd>
            </dl>
             
        </div>
             <div id="scrollTable" style="width:1100px">
            <table class="table">
                <col width="80px"></col>
                <col width="130px"></col>
                <col width="80px"></col>
                <col width="80px"></col>
                <col width="80px"></col>
                <col width="80px"></col>
                <col width="80px"></col>
                <col width="130px"></col>
                <col width="130px"></col>
                <col></col>
                <tbody>
                    <tr>
                       	  <th>序号</th>
                          <th>商品编号</th>
                          <th>商品名称</th>
                          <th>商品分类</th>
                          <th>规格</th>
                          <th>单位</th>
                          <th>库存数量</th> 
                          <th>出货数量</th> 
                          <th>签收人</th> 
                          <th>备注</th> 
                    </tr>
                </tbody>
            </table>
			<div>
            <table class="table" id="selectProduct" >
				<col width="80px"></col>
                <col width="130px"></col>
                <col width="80px"></col>
                <col width="80px"></col>
                <col width="80px"></col>
                <col width="80px"></col>
                <col width="80px"></col>
                <col width="130px"></col>
                <col width="130px"></col>
                <col></col>
                <tbody id="tbody">
                  
                </tbody>
            </table>
            </div>
        </div>
               <!----底部按钮----->
               <div class="btm_btn mt10">
                       <dl>
                            <dd><input class="btn" type="button" value="打印" ></dd>
                            <dd><input class="btn" type="button" value="返回" onClick="javascript:history.go(-1)"></dd>
                       </dl>
               </div>
               <!----底部按钮----->
    	</div>
	</div>
</div>
	<form action="${basePath}common/downloadAttFile.shtml" id="downloadFileForm" method="post">
   		<input type="hidden" name="attFile" value="${scmOutStg['fkAttFile']}">
   		<input type="hidden" name="key" value="${key}">
    </form>
</body>
</html>